package com.kelvin.manage.service.impl;

import com.kelvin.manage.common.Asserts;
import com.kelvin.manage.mapper.StudentMapper;
import com.kelvin.manage.mapper.TeacherMapper;
import com.kelvin.manage.mapper.UserMapper;
import com.kelvin.manage.model.Student;
import com.kelvin.manage.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeacherServiceimpl implements TeacherService {
    @Autowired
    StudentMapper studentMapper;
    @Autowired
    UserMapper userMapper;

    @Override
    public int deleteStudent(long id){
        Student student=studentMapper.getStudentById(id);
        if(student==null){
            Asserts.fail("该学生id不存在");}
        studentMapper.deleteStudent(id);
        userMapper.deldeteUser(student.getUser_id());
        return 1;
    }

}
